import http from '@/utils/http.js';

/**
 * 热门视频
 */
export function getPopular() {
  return http({
    url: 'https://api.bilibili.com/x/web-interface/popular',
    method: 'get'
  })
}
// 音频榜单
export function getMusic(data) {
  return http({
    url: 'https://api.bilibili.com/x/copyright-music-publicity/toplist/all_period',
    method: 'get',
    data
  })
}
/**
 * 获取入站必刷视频
 */
export function getPrecious() {
  return http({
    url: 'https://api.bilibili.com/x/web-interface/popular/precious',
    method: 'get'
  })
}
/** 
 * 分类搜索
 */
export function getSearchType() {
  return http({
    url: 'https://api.bilibili.com/x/web-interface/wbi/search/type',
    method: 'get'
  })
}
/**
 * 获取视频详细信息 https://api.bilibili.com/x/web-interface/wbi/view
 **/
export function getWbiView(data) {
  return http({
    url: 'https://api.bilibili.com/x/web-interface/wbi/view',
    method: 'get',
    data
  })
}
/**
 * 获取番剧视频流URL https://api.bilibili.com/pgc/player/web/playurl
 */
export function getPlayurl(data) {
  return http({
    url: 'https://api.bilibili.com/pgc/player/web/playurl',
    method: 'get',
    data
  })
}
/**
 * 短信验证码登录_app端
 */
export function loginSMS(data) {
  return http({
    url: 'https://passport.bilibili.com/x/passport-login/login/sms',
    method: 'post',
    data
  })
}
/**
 * 发送短信验证码_app端
 **/
export function sendSMS(data) {
  return http({
    url: 'https://passport.bilibili.com/x/passport-login/sms/send',
    method: 'post',
    data
  })
}
/**
 * 申请captcha验证码
 */
export function captcha() {
  return http({
    url: 'https://passport.bilibili.com/x/passport-login/captcha?source=main_web',
    method: 'get'
  })
}
/**
 * 申请二维码(TV端)
 * https://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code
 */
export function authCode(data) {
  return http({
    url: 'https://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code',
    method: 'post',
    data
  })
}

/**
 * 扫码登录(TV端)
 * https://passport.bilibili.com/x/passport-tv-login/qrcode/poll
 */
export function codeLogin(data) {
  return http({
    url: 'https://passport.bilibili.com/x/passport-tv-login/qrcode/poll',
    method: 'post',
    data
  })
}